<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="./adminTemplate.xhtml">

            <ui:define name="title">
                Enquiry List
            </ui:define>

            <ui:define name="contain">
                <h:form id="form">
                <h2 class="ico_mug">Information about Enquiry</h2>
                <p:messages autoUpdate="true" showDetail="true" showSummary="true"></p:messages>
                <p:dataTable var="listEnquiry" value="#{enquiryController.list}" id="table-item">  
                    <p:column>  
                        <f:facet name="header">  
                                Name  
                        </f:facet>  
                        <h:outputText value="#{listEnquiry.name}" />  
                    </p:column>  
                    <p:column>  
                        <f:facet name="header">  
                                Phone  
                        </f:facet>  
                        <h:outputText value="#{listEnquiry.phone}" />  
                    </p:column>  

                    <p:column>  
                        <f:facet name="header">  
                                Email  
                        </f:facet>  
                        <h:outputText value="#{listEnquiry.email}" />  
                    </p:column>  

                    <p:column>  
                        <f:facet name="header">  
                               Expected Date  
                        </f:facet>  
                        <h:outputText value="#{listEnquiry.expectedDate}" />  
                    </p:column>  

                     <p:column>  
                        <f:facet name="header">  
                                Description  
                        </f:facet>  
                         <h:outputText value="#{listEnquiry.description}" />  
                    </p:column>                

                    <p:column style="text-align: center">  
                        <f:facet name="header">  
                                Delete  
                        </f:facet>  
                        <p:commandLink action="#{enquiryController.selectedID(listEnquiry.id)}" oncomplete="confirmation.show()">
                            <img src="img/delete.png" alt="delete"/>
                         </p:commandLink>                        
                    </p:column>
                </p:dataTable> 
               
                    <p:confirmDialog id="confirmation" message="Are you sure to delete this Enquiry?"  
                                     header="Delete Enquiry" severity="alert" widgetVar="confirmation" > 
                        <p:commandButton value="Yes Sure" update=":form:table-item" oncomplete="confirmation.hide()"  
                                         actionListener="#{enquiryController.deleteEnquery}" />  
                        <p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />   
                    </p:confirmDialog>                  
            </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
